/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.GUI.actions;

import controller.commands.DeleteCommand;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import model.graphic.objects.Graphical;
import view.GUI.sidepanels.CustomArgument;
import view.GUI.graphic.GraphicView;

/**
 *
 * @author Jelle
 */
public class DeleteAction extends AbstractAction {

    private GraphicView gview;
    private Graphical g;
    private boolean clearAll;

    public DeleteAction(Boolean clearAll, GraphicView gview, Graphical g) {
        this.gview = gview;
        this.clearAll = clearAll;
        this.g = g;
    }

    public DeleteAction(Boolean clearAll, GraphicView gview) {
        this.gview = gview;
        this.clearAll = clearAll;
    }

    public void actionPerformed(ActionEvent e) {
        if (clearAll) {
            gview.notifyObservers(new DeleteCommand());
            gview.notifyObservers(new CustomArgument("tabRight", 1));
        } else {
            gview.notifyObservers(new DeleteCommand(g));
            gview.notifyObservers(new CustomArgument("tabRight", 1));
        }
        gview.repaint();

    }
}
